
{extend name='public/base' /}
{block name="css"}

{/block}
{block name="content"}

<div class="ibox xiaoshi">
    <div class="ibox-content">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form class="form-inline" id="form">
                    <div class="select-list">
                        <ul>
                            {:li_input('配置名','name')}

                            <li class="select-selectpicker">
                                配置分类：
                                <select name="group_id" class="selectpicker" data-none-selected-text="请选择">
                                    <option value="">所有</option>
                                    {$gropu|make_option='','title','id'}
                                </select>
                            </li>

                            {:li_time('时间范围')}

                            {:li_search()}

                        </ul>
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>

<div class="row">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-content">
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-success  btn-rounded {:node('Sysconfig/addConfig')}" onclick="$.form.add()">
                        <i class="fa fa-plus"></i> 新增
                    </a>
                    <a class="btn btn-primary btn-rounded single {:node('Sysconfig/update')}" onclick="$.form.edit()">
                        <i class="fa fa-edit"></i> 修改
                    </a>
                    <a class="btn btn-danger btn-rounded multiple {:node('Sysconfig/del')}" onclick="$.form.removeAll()">
                        <i class="fa fa-remove"></i> 删除
                    </a>
                </div>
                <div class="table-striped">
                    <table id="bootstrap-table" ></table>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}

{block name="js"} <!--js处理区-->

<script>
    $(function() {
        var options = {
            url: "{:url('index')}",
            deleteUrl:  "{:url('del')}?id={id}", //删除链接
            exportUrl:  "{:url('export')}",  //导出
            updateUrl: "{:url('update')}?id={id}", //编辑
            addUrl:    "{:url('addConfig')}", //添加
            detailUrl:  "/detailUrl",    //详细
            sortName: "id",
            sortOrder: "desc",
            modalName: "配置列表",
            onDblClickRow:onDblClickRow, //双击行编辑
            columns:
                [{
                checkbox: true
                 },
                {
                    field: 'id',
                    title: 'ID'
                },
                {
                    field: 'sysconfigtab.title',
                    title: '分类名称'
                },
                {
                    field: 'group',
                    title: '分类英文名'
                },
                {
                    field: 'name',
                    title: '配置名'
                },
                {
                    field: 'value',
                    title: '配置值'
                },
                {
                    field: 'beizhu',
                    title: '备注'
                },
                {
                    field: 'create_time',
                    title: '添加时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return edit_del(row);
                    }

                }]
        };
        $.table.init(options);
    });

    function edit_del(row) {
        var actions = [];
        actions.push('<a class="btn btn-xs btn-success  {:node(\'Sysconfig/update\')}" data-original-title="编辑" data-toggle="tooltip" onclick="$.form.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i></a>');
        actions.push('<a class="btn btn-danger btn-xs {:node(\'Sysconfig/del\')}" data-original-title="删除" data-toggle="tooltip" onclick="$.form.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i></a>');
        return actions;
    }

    //双击行编辑
    function onDblClickRow(row) {
        // alert(JSON.stringify(row))
        $.form.edit(row.id);
    }

</script>

{/block}
